home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Personal Computer World 2009 February
/
PCWFEB09.iso
/
Software
/
Shareware
/
IDimager Personal 4.2.0.3
/
setup_IDimager_Personal_V4.exe
/
{app}
/
web
/
modules
/
imagecomments.psc
< prev
next >
Wrap
Text File
|
2008-06-21
|
4KB
|
102 lines
%include uservalidate.inc %/include
%code
%include storeddata.inc %/include
%include publicfunctions.inc %/include
var
AItems: TCatalogItems;
APage: Integer;
AComments: TCatalogItemComments;
AComment: TCatalogItemComment;
i: Integer;
ALink: WideString;
begin
result := toWideString('');
if not FindStoredData (Request.Params.Values['ds'], AItems, False) then
exit;
APage := 1;
if IsValidNumberString(Request.Params.Values['page'], False) then
APage := StrToInt(Request.Params.Values['page']);
AItem := AItems.Items[APage - 1];
ALink := 'javascript:postForm($(''frmComment''), ''%var:PageOffset/modules/storecomment.psc'', ''%var:PageOffset/modules/imagecomments.psc'', ''' + AjaxContainer + ''', ''ds=' + Request.Params.Values['ds'] + '&GUID=' + AItems.GUID + '&Page=' + IntToStr(APage) + ''')';
if CanUpdateComment (Request.Params.Values['EditGUID']) then
begin
AComment := TCatalogItemComment.Create(nil);
if not Catalog.EnumCommentByGUID (Request.Params.Values['EditGUID'], AComment) then
begin
AComment.Free;
AComment := nil;
end;
end
else
AComment := nil;
result := result + '<form id="frmComment" method="post" action="' + ALink + '">';
result := result + '<br/><big>Add a comment:</big><br/>'
if AComment <> nil then
begin
result := result + '<input type="hidden" name="dfItemGUID" value="' + AComment.GUID + '">';
end;
result := result + '<textarea id="textComment" class="editObject" name="mmComments" cols="80">';
if AComment <> nil then
result := result + FormatForHTMLEditing (AComment.Comments.Text);
result := result + '</textarea>';
result := result + '<br/><input class="editObject" type="submit" value="that''s my opinion">';
result := result + '</form>';
if AComment <> nil then
AComment.Free;
AComments := TCatalogItemComments.Create (TCatalogItemComment, '');
result := result + '<div id="comments">';
Catalog.EnumCommentsForItem (AItem, AComments);
for i := 0 to AComments.Count - 1 do
begin
result := result + '<div id="commentblock' + iif(i mod 2 = 0, 'even', 'uneven') + '">';
if IsAdmin then
begin
end;
if (IsAdmin or (i = 0)) and CanUpdateComment (AComments.Items[i].GUID) then
begin
ALink := 'javascript:getHTMLChain(' +
'[' +
' [''%var:PageOffset/./modules/removecomment.psc'', ''' + AjaxContainer + ''', ''GUID=' + AComments.Items[i].GUID + '''], ' +
' [''%var:PageOffset/./modules/imagecomments.psc'', ''' + AjaxContainer + ''', ''ds=' + Request.Params.Values['ds'] + '&GUID=' + AItems.GUID + '&Page=' + Request.Params.Values['Page'] + '''] ' +
']' +
')';
result := result + '<a href="' + ALink + '" title="delete this comment..."><img src="%var:PageOffset/images/delete.png"></a>';
ALink := 'javascript:getHTMLChain(' +
'[' +
' [''%var:PageOffset/./modules/imagecomments.psc'', ''' + AjaxContainer + ''', ''ds=' + Request.Params.Values['ds'] + '&GUID=' + AItems.GUID + '&Page=' + Request.Params.Values['Page'] + '&EditGUID=' + AComments.Items[i].GUID + '''] ' +
']' +
')';
result := result + '<a href="' + ALink + '" title="edit this comment..."><img src="%var:PageOffset/images/edit.png"></a>';
end;
result := result + '<span class="commentHeader"><strong>' + AComments.Items[i].FullUserName + '</strong> <i>' + FormattedDateTime ('yyyy-mm-dd hh:nn', AComments.Items[i].Moment) + '</i> </span><br/>' + FormatForHTML(AComments.Items[i].Comments.Text);
result := result + '</div>';
end;
result := result + '</div>';
AComments.Free;
end;
%/code